<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <button>ajax请求</button>
    <button>GET请求</button>
    <button>POST请求</button>
    <p></p>

    <script src="https://cdn.jsdelivr.net/npm/jquery@1.12.4/dist/jquery.min.js"></script>
    <script>
        $(function () {
            $("button:eq(0)").click(function () {
               $.ajax({
                   "url":"/ajax?id=xxx",
                   "dataType" : "text",
                   "success" : function (result) {
                       $("p").html(result);
                   }
               });
            });

            $("button:eq(1)").click(function () {
                $.get("/ajax?id=get",function (result) {
                    $("p").html("$.get():"+result);
                },"text");
            });

            $("button:eq(2)").click(function () {
                $.post("/ajax","name=xxx&id=post",function (result) {
                    $("p").html("$.post():"+result);
                },"text");
            });
        });
    </script>

</body>
</html>